package com.tensquare.controller;

import com.zhenzi.sms.ZhenziSmsClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("sms")
public class SmsController {


    @GetMapping
    public Object SmsSend() throws Exception {
        String apiUrl = "https://sms_developer.zhenzikj.com";

        String appId = "110052";
        String appSecret= "YjBiY2JiMWYtZGY4Mi00YTFlLWJlZTMtNGI3YThiYWJjNWE0";
        ZhenziSmsClient client = new ZhenziSmsClient(apiUrl, appId, appSecret);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("number", "13023491256");
        params.put("templateId", "6845");
        String[] templateParams = new String[2];
        templateParams[0] = "6845";
        templateParams[1] = "6845";
        params.put("templateParams", templateParams);
        String result = client.send(params);
        return result;
    }
}
